// https://leetcode-cn.com/problems/hamming-distance/submissions/
class Solution {
public:
    int hammingDistance(int x, int y) {
        int cnt = 0;
        int tmp = x ^ y;
        while (tmp) {
            cnt += tmp & 1;
            tmp >>= 1;
        }
        return cnt;
    }
};